﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BSCMFF.Core.DataAccessLayer;
using BSCMFF.Core;

namespace BSCMFF.Web.Pages.Surveys
{
    public partial class CreateSurvey : MultiLanguagePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void RadButtonBack_Click(object sender, EventArgs e)
        {
            Response.Redirect("ManageSurveys.aspx");
        }

        protected void RadButtonConfirmDetails_Click(object sender, EventArgs e)
        {
            PlaceHolderQuestions.Visible = true;
            //RadButtonConfirmDetails.Visible = false;
            sd.IsEditMode = false;
            RadButtonSubmit.Visible = true;
            
            PanelDetails.Enabled = false;


        }
        
        
        private void LoadSurvey()
        {
            //            if (!IsPostBack)
//            {
//                if (Request.QueryString["Survey_FormID"] != null)
//                {
//                    int surID = Convert.ToInt32(Request.QueryString["Survey_FormID"]);


//                    BSCEntities context = new BSCEntities();
//                    Survey_Form selectedSurvey = (from sur in context.Survey_Form
//                                                  where sur.ID == surID
//                                                  select sur).SingleOrDefault();
//                    sd.Survey = selectedSurvey;
//                    sd.DataBind();

//                    LoadQuestions(surID);
//                }
//            }
//        }

//        private void LoadQuestions(int surID)
//        {
//            BSCEntities context = new BSCEntities();

//            List<Survey_Question> questions = (from question in context.Survey_Question
//                                               where question.Form_FK == surID
//                                               select question).ToList();
//            int i = 0;
//            foreach (Survey_Question sq in questions)
//            {
//                LiteralControl lc = new LiteralControl(
//                    @"<li  id='Question'" + i.ToString() + @" class='ui-state-default'>
//                        <div >
//                            <input id='TextBoxQuestion'" + i.ToString() + "  value='" + sq.Question + @"' name='TextBoxQuestion' type='text'  style='width:500px' />
//                            <div id='Answers' style='right:20px;top:5px' >
//                                <div id='Answer'>
//                                    <input id='RadioButtonAnswer' name='RadioButtonAnswer' type='radio' disabled='disabled' />
//                                    <input id='TextBoxAnswer' name='TextBoxAnswer' type='text' />
//                                </div>
//                                <span id='ButtonsAnswer' style='display:none'>
//                                    <a id='removeAnswer' href=''>[-]</a> 
//                                    <a id='addAnswer' href=''  >[+]</a>
//                                </span>
//                            </div>
//                        </div>
//                    </li>");

//                sortable.Controls.Add(lc);
//            }
        }

        protected void RadButtonBack_Click1(object sender, EventArgs e)
        {
            Response.Redirect("ManageSurveys.aspx");
        }
    }
}